



// #include "cjson_api_readAttr.h"

//#if 0

#ifndef __CJSON_API_READ_ATTR_H__
#define __CJSON_API_READ_ATTR_H__

#include "../utility/cJSON.h"
#include "dev_manager.h"
#include <stdint.h>

//#include "tcp_api_01.h" 
//#include "gw_ktj_tcp_client.h" 


	// 	"mac": "FFFFFFFFFFFF",   //  12个ff可以不发
	// 	"nodeType": 1,
	// 	"channel": 1,
	// 	"name": "dev041",    // 可以不要
	// 	"privAddr": 55
    //读单个设备的全部属性
void json_readAttr_single(uint8_t dev_addr, uint8_t channel,uint8_t nodeType );

	//(	"mask",	"01");
	//(	"classMask",	"11");
void json_readAttr_single_with_mask(uint8_t dev_addr, uint8_t channel,uint8_t nodeType,char* mask_str, char* class_mask_str );


    //读单个设备的几个属性
void json_readAttr_single_num_by_dpid(uint8_t dev_addr, uint8_t channel,uint8_t nodeType,uint8_t dpid_num,  uint32_t* dpid_buf );

    //读单个设备的几个属性
void json_readAttr_single_num_by_name(uint8_t dev_addr, uint8_t channel,uint8_t nodeType,uint8_t attrNum,  char* attrStart );


//void json_read_cmd_with_data(const char* cmd_str,const char* cct_id_str,const int msg_id );


//"nodeType":1,"channel":2,"privAddr":1,
//   info.node_type = 1;
//   info.chan_addr = 1;
//   info.channel = 2;

// 	"attrLst": [{
// 		"name": "thTH",
// 		"lable": "温度过高阈值",    //  可以不要
// 		"val": "98",
//"deviceName": "oilLevel_2_1",
uint8_t json_write_setAttr_dev( dev_mod_info_t* info,const char* dev_name_str,const char* attr_name_str ,uint32_t attr_val );



//"deviceName": "oilLevel_2_1",
/////  // 一次写设备所有R/W的配置参数----json 协议参数用的是name------需要维护name 表---
uint8_t json_write_setAttr_dev_config_all_with_name(const uint8_t index,const uint8_t seq, dev_mod_info_t* info );

//
///// //一次只写一个 iot_id 对应的配置参数--------json 协议参数用的是 dpid------
uint8_t json_write_setAttr_dev_config_one_with_pdip(const uint8_t index,const uint8_t seq, dev_mod_info_t* info,void* iot_model );


/////  // 一次写设备所有R/W的配置参数----json 协议参数用的是 iot_id------需要维护 iot_id 表---
uint8_t json_write_setAttr_dev_config_all_with_pdip(const uint8_t index,const uint8_t seq, dev_mod_info_t* info );
                
/*-----------------------------------------------------------------------------------
        iot_find_node_index_with_sub_uid
        found sub_uid=5,indx=0
        iot_get_mod_info_with_index
        got info:indx=0, chan_addr=1,channel=1,node_type=d000,dev_name=0xd3f4f
        set addr 0610, value = 7
        set addr 0611, value = 2500
        set addr 0612, value = 7700
        set addr 0606, value = 1200
        set addr 0607, value = 3600
        json_write_setAttr_dev_config_all_with_pdip
        name_str_buf=tempe_1_3{"head":{"gatewayId":"gw_CC0500CFB180","msgId":69,"cmd":"setAttr"},"data":{"deviceName":"tempe_1_3","mac":"FFFFFFFFFFFF","nodeType":1,"channel":1,"privAddr":1},"attrLst":[{"dpid":1536,"val":0},{"dpid":1538,"val":0},{"dpid":1542,"val":1200},{"dpid":1543,"val":3600},{"dpid":1552,"val":7},{"dpid":1553,"val":2500},{"dpid":1554,"val":7700},{"dpid":1555,"val":0},{"dpid":1556,"val":0},{"dpid":1557,"val":0},{"dpid":1558,"val":0}]}
        15:51:51-TCP_API_Send_Now


        name_str_buf=tempe_1_3{"head":
            {"gatewayId":"gw_CC0500CFB180",
            "msgId":69,"cmd":"setAttr"},"data":
            {"deviceName":"tempe_1_3",
            "mac":"FFFFFFFFFFFF",
            "nodeType":1,"channel":1,"privAddr":1},
            "attrLst":[
            {"dpid":1536,"val":0},
            {"dpid":1538,"val":0},
            {"dpid":1542,"val":1200},
            {"dpid":1543,"val":3600},
            {"dpid":1552,"val":7},
            {"dpid":1553,"val":2500},
            {"dpid":1554,"val":7700},
            {"dpid":1555,"val":0},
            {"dpid":1556,"val":0},
            {"dpid":1557,"val":0},
            {"dpid":1558,"val":0}]}
            15:51:51-TCP_API_Send_Now
            Tcp_TxData[1].Buff=0xd36f2,pdata=0x3fe8002510,len= 426

 ---------------------------------------------------------------------------------*/



#endif     //////------__CJSON_API_READ_ATTR_H__--------------






